<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script type="text/javascript">
        function del(arr) {
            const temp = arr.slice();
            if (temp.length > 0) {
                temp.length -= 1;
            }
            return temp;
        }
        console.log(del([1, 2, 3]));

        function del1(arr) {
            let temp = arr.slice();
            temp.pop();
            return temp;
        }
        console.log(del1([1, 2, 3]));

        function del2(arr) {
            let temp = arr.slice(0, arr.length - 1);
            return temp;
        }
        console.log(del2([1, 2, 3]));

        function del3(arr) {
            return arr.slice(0, -1);
        }
        console.log(del3([1, 2, 3]));

        function delBefore(arr) {
            
        }
    </script>
</body>

</html>